package xyz.robinbingo.leetcode.a20.b07.c08;

import java.util.stream.IntStream;

public class Solution {
    public int[] divingBoard(int shorter, int longer, int k) {
        if (k == 0) {
            return new int[0];
        }
        return IntStream.rangeClosed(0, k)
                .mapToObj(i -> (long) shorter * i + (long) longer * (k - i))
                .distinct()
                .mapToInt(Long::intValue)
                .sorted()
                .toArray();
    }
}